// ----------------------------------------------------------------------------
// Copyright 2019-2021 Pelion Ltd.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------

#ifndef __FOTA_CONFIG_H_
#define __FOTA_CONFIG_H_

#if !defined(FOTA_UNIT_TEST)
#include "MbedCloudClientConfig.h"
#else
#include "fota_unittest_config.h"
#endif

#ifdef MBED_CLOUD_CLIENT_FOTA_ENABLE

#if defined (__ICCARM__)
#define fota_deprecated
#else
#define fota_deprecated __attribute__ ((deprecated))
#endif

#define FOTA_RESUME_UNSUPPORTED     0
#define FOTA_RESUME_SUPPORT_RESTART 1
#define FOTA_RESUME_SUPPORT_RESUME  2

#define FOTA_INTERNAL_FLASH_MBED_OS_BD    1
#define FOTA_CUSTOM_MBED_OS_BD            2
#define FOTA_EXTERNAL_BD                  3
#define FOTA_DEFAULT_MBED_OS_BD           4

#define FOTA_MULTICAST_UNSUPPORTED  0
#define FOTA_MULTICAST_NODE_MODE    1
#define FOTA_MULTICAST_BR_MODE      2

#define MBED_CLOUD_CLIENT_FOTA_COAP_DOWNLOAD      1
#define MBED_CLOUD_CLIENT_FOTA_CURL_HTTP_DOWNLOAD 2

#if defined(MBED_CLOUD_CLIENT_SUPPORT_UPDATE)

#define FOTA_SHIM_LAYER
#define FOTA_MANIFEST_SCHEMA_VERSION 3

#ifndef FOTA_DEFAULT_APP_IFS
#define FOTA_DEFAULT_APP_IFS 0
#endif

#undef  MBED_CLOUD_CLIENT_FOTA_RESUME_SUPPORT
#define MBED_CLOUD_CLIENT_FOTA_RESUME_SUPPORT FOTA_RESUME_UNSUPPORTED

#define MBED_CLOUD_CLIENT_FOTA_FW_HEADER_VERSION 2

#define ARM_UCP_FLASHIAP_MCUBOOT     10100
#define ARM_UCP_FLASHIAP_BLOCKDEVICE 10101
#define ARM_UCP_FLASHIAP             10110

#if MBED_CLOUD_CLIENT_UPDATE_STORAGE == ARM_UCP_FLASHIAP

#define MBED_CLOUD_CLIENT_FOTA_BLOCK_DEVICE_TYPE FOTA_INTERNAL_FLASH_MBED_OS_BD
#define MBED_CLOUD_CLIENT_FOTA_STORAGE_SIZE MBED_CONF_UPDATE_CLIENT_STORAGE_SIZE
#define MBED_CLOUD_CLIENT_FOTA_STORAGE_START_ADDR MBED_CONF_UPDATE_CLIENT_STORAGE_ADDRESS + MBED_ROM_START

#elif MBED_CLOUD_CLIENT_UPDATE_STORAGE == ARM_UCP_FLASHIAP_BLOCKDEVICE

#define MBED_CLOUD_CLIENT_FOTA_BLOCK_DEVICE_TYPE FOTA_DEFAULT_MBED_OS_BD
#define MBED_CLOUD_CLIENT_FOTA_STORAGE_SIZE MBED_CONF_UPDATE_CLIENT_STORAGE_SIZE
#define MBED_CLOUD_CLIENT_FOTA_STORAGE_START_ADDR MBED_CONF_UPDATE_CLIENT_STORAGE_ADDRESS
#define MBED_CLOUD_CLIENT_FOTA_FW_HEADER_EXTERNAL 1  // v2 external header

#elif MBED_CLOUD_CLIENT_UPDATE_STORAGE == ARM_UCP_FLASHIAP_MCUBOOT
#error "ARM_UCP_FLASHIAP_MCUBOOT is not supported"

#endif // MBED_CLOUD_CLIENT_UPDATE_STORAGE == ARM_UCP_FLASHIAP

#define MBED_CLOUD_CLIENT_UPDATE_DOWNLOAD_PROTOCOL_COAP 1
#define MBED_CLOUD_CLIENT_UPDATE_DOWNLOAD_PROTOCOL_HTTP 2

#if defined(MBED_CONF_MBED_CLOUD_CLIENT_UPDATE_DOWNLOAD_PROTOCOL)
#if MBED_CONF_MBED_CLOUD_CLIENT_UPDATE_DOWNLOAD_PROTOCOL == MBED_CLOUD_CLIENT_UPDATE_DOWNLOAD_PROTOCOL_COAP
#define MBED_CLOUD_CLIENT_FOTA_DOWNLOAD MBED_CLOUD_CLIENT_FOTA_COAP_DOWNLOAD
#elif MBED_CONF_MBED_CLOUD_CLIENT_UPDATE_DOWNLOAD_PROTOCOL == MBED_CLOUD_CLIENT_UPDATE_DOWNLOAD_PROTOCOL_HTTP
#define MBED_CLOUD_CLIENT_FOTA_DOWNLOAD MBED_CLOUD_CLIENT_FOTA_CURL_HTTP_DOWNLOAD
#else
#error "Invalid value for MBED_CONF_MBED_CLOUD_CLIENT_UPDATE_DOWNLOAD_PROTOCOL. Must be either MBED_CLOUD_CLIENT_UPDATE_DOWNLOAD_PROTOCOL_HTTP or MBED_CLOUD_CLIENT_UPDATE_DOWNLOAD_PROTOCOL_COAP."
#endif
#endif // MBED_CONF_MBED_CLOUD_CLIENT_UPDATE_DOWNLOAD_PROTOCOL

#if defined(MBED_CLOUD_CLIENT_SUPPORT_MULTICAST_UPDATE)
#if defined(MBED_CLOUD_CLIENT_MULTICAST_BORDER_ROUTER)
#define MBED_CLOUD_CLIENT_FOTA_MULTICAST_SUPPORT FOTA_MULTICAST_BR_MODE
#else
#define MBED_CLOUD_CLIENT_FOTA_MULTICAST_SUPPORT FOTA_MULTICAST_NODE_MODE
#endif
#endif // MBED_CLOUD_CLIENT_SUPPORT_MULTICAST_UPDATE

#endif //defined(MBED_CLOUD_CLIENT_SUPPORT_UPDATE)

// Right now, PAL support has a one to one relation with client profile.
// This can change in the future.
#if MBED_CLOUD_CLIENT_PROFILE == MBED_CLOUD_CLIENT_PROFILE_LITE
#ifndef MBED_CLOUD_CLIENT_FOTA_SUPPORT_PAL
#define MBED_CLOUD_CLIENT_FOTA_SUPPORT_PAL 0
#endif
#elif MBED_CLOUD_CLIENT_PROFILE == MBED_CLOUD_CLIENT_PROFILE_FULL
#ifndef MBED_CLOUD_CLIENT_FOTA_SUPPORT_PAL
#define MBED_CLOUD_CLIENT_FOTA_SUPPORT_PAL 1
#endif
#else
#error Client profile not defined
#endif

#if defined(TARGET_LIKE_LINUX)

#if !defined(MBED_CLOUD_CLIENT_FOTA_STORAGE_SIZE)
// No limit
#define MBED_CLOUD_CLIENT_FOTA_STORAGE_SIZE ((size_t) -1)
#endif

// Following files are preceded by mbed client config directory, which defaults to the one used by storage
// It can be overridden by defining MBED_CLOUD_CLIENT_FOTA_LINUX_CONFIG_DIR

#if !defined(MBED_CLOUD_CLIENT_FOTA_LINUX_HEADER_FILENAME)
#define MBED_CLOUD_CLIENT_FOTA_LINUX_HEADER_FILENAME "fota_fw_metadata"
#endif

#define MBED_CLOUD_CLIENT_FOTA_LINUX_TEMP_HEADER_FILENAME MBED_CLOUD_CLIENT_FOTA_LINUX_HEADER_FILENAME ".tmp"

#if !defined(MBED_CLOUD_CLIENT_FOTA_LINUX_UPDATE_STORAGE_FILENAME)
#define MBED_CLOUD_CLIENT_FOTA_LINUX_UPDATE_STORAGE_FILENAME "fota_update_storage"
#endif

#if !defined(MBED_CLOUD_CLIENT_FOTA_LINUX_CANDIDATE_FILENAME)
#define MBED_CLOUD_CLIENT_FOTA_LINUX_CANDIDATE_FILENAME "fota_candidate"
#endif

#if defined(FOTA_UNIT_TEST)
// Unit tests don't actually replace the current running app, but use a test file
extern char *unitest_curr_fw_filename;
#define MBED_CLOUD_CLIENT_FOTA_LINUX_CURR_FW_FILENAME unitest_curr_fw_filename
#else
// Real application - replace real exe file
#include <errno.h>
extern char *program_invocation_name;
#define MBED_CLOUD_CLIENT_FOTA_LINUX_CURR_FW_FILENAME program_invocation_name
#endif

// No legacy bootloader here - force up to date header
#undef MBED_CLOUD_CLIENT_FOTA_FW_HEADER_VERSION
#define MBED_CLOUD_CLIENT_FOTA_FW_HEADER_VERSION 3

#endif // defined(TARGET_LIKE_LINUX)

// Set this flag to 1 to use custom verification logic for main app installation
#if !defined(FOTA_CUSTOM_MAIN_APP_VERIFY_INSTALL)
// Use default verification logic otherwise
#define FOTA_CUSTOM_MAIN_APP_VERIFY_INSTALL 0
#endif

// Set this flag to 0 to save post upgrade verification code
#if !defined(FOTA_VERIFY_INSTALLATION_AFTER_UPGRADE)
// Logic should be enabled by default otherwise
#define FOTA_VERIFY_INSTALLATION_AFTER_UPGRADE 1
#endif

#ifndef MBED_CLOUD_CLIENT_FOTA_BLOCK_DEVICE_TYPE
#define MBED_CLOUD_CLIENT_FOTA_BLOCK_DEVICE_TYPE FOTA_EXTERNAL_BD // if not defined - fall back to an external configuration
#endif

#if MBED_CLOUD_CLIENT_FOTA_EXTERNAL_DOWNLOADER
// External downloader means that fragments are received externally, just like multicast node mode
// So this basically imitates the multicast node mode
#if defined(MBED_CLOUD_CLIENT_FOTA_MULTICAST_SUPPORT) && (MBED_CLOUD_CLIENT_FOTA_MULTICAST_SUPPORT != FOTA_MULTICAST_NODE_MODE)
#error External downloader mode can only be supported with multicast node mode
#else
#undef MBED_CLOUD_CLIENT_FOTA_MULTICAST_SUPPORT
#define MBED_CLOUD_CLIENT_FOTA_MULTICAST_SUPPORT FOTA_MULTICAST_NODE_MODE
#endif
#endif

#ifndef MBED_CLOUD_CLIENT_FOTA_MULTICAST_SUPPORT
#define MBED_CLOUD_CLIENT_FOTA_MULTICAST_SUPPORT FOTA_MULTICAST_UNSUPPORTED
#endif

#if (MBED_CLOUD_CLIENT_FOTA_BLOCK_DEVICE_TYPE == FOTA_INTERNAL_FLASH_MBED_OS_BD) || (MBED_CLOUD_CLIENT_FOTA_BLOCK_DEVICE_TYPE == FOTA_DEFAULT_MBED_OS_BD ) || (MBED_CLOUD_CLIENT_FOTA_BLOCK_DEVICE_TYPE == FOTA_CUSTOM_MBED_OS_BD )

// on Mbed-OS port, when using internal flash or custom BlockDevices - it is expected for configuration to
//  provide storage start address and size
#if !defined(MBED_CLOUD_CLIENT_FOTA_STORAGE_SIZE) || (MBED_CLOUD_CLIENT_FOTA_STORAGE_SIZE == 0)
#error Storage size should be defined and have a nonzero value
#endif

#if !defined(MBED_CLOUD_CLIENT_FOTA_STORAGE_START_ADDR)
#error "MBED_CLOUD_CLIENT_FOTA_STORAGE_START_ADDR must be set"
#endif

#if (MBED_CLOUD_CLIENT_FOTA_RESUME_SUPPORT == FOTA_RESUME_SUPPORT_RESUME)
#if !defined(FOTA_BD_SIMULATE_ERASE)
#define FOTA_BD_SIMULATE_ERASE 1
#endif
#endif

#endif  // (MBED_CLOUD_CLIENT_FOTA_BLOCK_DEVICE_TYPE == FOTA_INTERNAL_FLASH_MBED_OS_BD) || (MBED_CLOUD_CLIENT_FOTA_BLOCK_DEVICE_TYPE == FOTA_DEFAULT_MBED_OS_BD ) || (MBED_CLOUD_CLIENT_FOTA_BLOCK_DEVICE_TYPE == FOTA_CUSTOM_MBED_OS_BD ) 

#if MBED_CLOUD_CLIENT_FOTA_BLOCK_DEVICE_TYPE == FOTA_EXTERNAL_BD
#ifndef MBED_CLOUD_CLIENT_FOTA_STORAGE_START_ADDR
#define MBED_CLOUD_CLIENT_FOTA_STORAGE_START_ADDR 0
#endif
#endif

#if !defined(FOTA_MANIFEST_SCHEMA_VERSION)
#define FOTA_MANIFEST_SCHEMA_VERSION        3
#endif

#if !defined(FOTA_MANIFEST_URI_SIZE)
#define FOTA_MANIFEST_URI_SIZE            256
#endif

#if !defined(FOTA_MANIFEST_VENDOR_DATA_SIZE)
#define FOTA_MANIFEST_VENDOR_DATA_SIZE    0
#endif
#if !defined(FOTA_VENDOR_ID_LEN)
#define FOTA_VENDOR_ID_LEN                      16
#endif
#if !defined(FOTA_CLASS_ID_LEN)
#define FOTA_CLASS_ID_LEN                       16
#endif
#if (FOTA_MANIFEST_VENDOR_DATA_SIZE > 0)  // asn.1 (TLV) overhead 
#define __FOTA_VENDOR_DATA_OVERHEAD 4
#else
#define __FOTA_VENDOR_DATA_OVERHEAD 0
#endif

#if !defined(FOTA_CERT_MAX_SIZE)
#define FOTA_CERT_MAX_SIZE 600
#endif

#if !defined(MBED_CLOUD_CLIENT_FOTA_CANDIDATE_BLOCK_SIZE)
#define MBED_CLOUD_CLIENT_FOTA_CANDIDATE_BLOCK_SIZE 1024
#endif

#if !defined(MBED_CLOUD_CLIENT_FOTA_ENCRYPTION_SUPPORT)
#define MBED_CLOUD_CLIENT_FOTA_ENCRYPTION_SUPPORT 0
#endif  // !defined(MBED_CLOUD_CLIENT_FOTA_ENCRYPTION_SUPPORT)

#define FOTA_USE_DEVICE_KEY    1
#define FOTA_USE_ENCRYPTED_ONE_TIME_FW_KEY  2

#if MBED_CLOUD_CLIENT_FOTA_ENCRYPTION_SUPPORT == 1 && !defined(MBED_CLOUD_CLIENT_FOTA_KEY_ENCRYPTION)
#define MBED_CLOUD_CLIENT_FOTA_KEY_ENCRYPTION FOTA_USE_ENCRYPTED_ONE_TIME_FW_KEY
#endif

#if MBED_CLOUD_CLIENT_FOTA_ENCRYPTION_SUPPORT == 0

#if defined(MBED_CLOUD_CLIENT_FOTA_KEY_ENCRYPTION)
#warning MBED_CLOUD_CLIENT_FOTA_KEY_ENCRYPTION is ignored if MBED_CLOUD_CLIENT_FOTA_ENCRYPTION_SUPPORT is disabled
#endif

#else // MBED_CLOUD_CLIENT_FOTA_ENCRYPTION_SUPPORT == 1

#if (MBED_CLOUD_CLIENT_FOTA_KEY_ENCRYPTION != FOTA_USE_DEVICE_KEY) && \
    (MBED_CLOUD_CLIENT_FOTA_KEY_ENCRYPTION != FOTA_USE_ENCRYPTED_ONE_TIME_FW_KEY)
#error Unknown MBED_CLOUD_CLIENT_FOTA_KEY_ENCRYPTION type
#endif

#if (MBED_CLOUD_CLIENT_FOTA_KEY_ENCRYPTION == FOTA_USE_DEVICE_KEY)
#warning FOTA_USE_DEVICE_KEY is deprecated and contains security vulnerability. \
          Please consider using FOTA_USE_ENCRYPTED_ONE_TIME_FW_KEY instead.
#endif

#if (MBED_CLOUD_CLIENT_FOTA_CANDIDATE_BLOCK_SIZE != FOTA_CLOUD_ENCRYPTION_BLOCK_SIZE)
#warning 'encrypted-raw' payload format will not be supported because \
          MBED_CLOUD_CLIENT_FOTA_CANDIDATE_BLOCK_SIZE is different than cloud encryption block size.
#endif

#endif

#define FOTA_PUBLIC_KEY_NOT_SUPPORTED_FORMAT   0
#define FOTA_RAW_PUBLIC_KEY_FORMAT             1
#define FOTA_X509_PUBLIC_KEY_FORMAT            2

// manifest schema V3 (and newer) support public key in both
// uncompressed elliptic curve point format (X9.62) and x509
// x509 is used by default. x9.62 is used for optimizations
// but requires integration with FCU tool and crypto backend.
#if !defined(MBED_CLOUD_CLIENT_FOTA_PUBLIC_KEY_FORMAT)
#if defined(FOTA_USE_EXTERNAL_UPDATE_RAW_PUBLIC_KEY)
#define MBED_CLOUD_CLIENT_FOTA_PUBLIC_KEY_FORMAT FOTA_RAW_PUBLIC_KEY_FORMAT
#else
#define MBED_CLOUD_CLIENT_FOTA_PUBLIC_KEY_FORMAT FOTA_X509_PUBLIC_KEY_FORMAT
#endif
#endif

#if (MBED_CLOUD_CLIENT_FOTA_PUBLIC_KEY_FORMAT == FOTA_RAW_PUBLIC_KEY_FORMAT) && (FOTA_MANIFEST_SCHEMA_VERSION == 1)
#error manifest schema V1 only supports public key in x.509 format
#endif

#if defined(FOTA_USE_EXTERNAL_UPDATE_RAW_PUBLIC_KEY) && (MBED_CLOUD_CLIENT_FOTA_PUBLIC_KEY_FORMAT == FOTA_X509_PUBLIC_KEY_FORMAT)
#error public key in x.509 format not allowed for external raw public key configuration
#endif

#if (FOTA_MANIFEST_SCHEMA_VERSION < 3)

#define FOTA_SOURCE_LEGACY_OBJECTS_REPORT 1

#if defined(FOTA_DISABLE_DELTA)
#define __FOTA_MANIFEST_BASE_SIZE 286
#else
#define __FOTA_MANIFEST_BASE_SIZE 361
#endif

#else  // (FOTA_MANIFEST_SCHEMA_VERSION < 3)
#define FOTA_SOURCE_LEGACY_OBJECTS_REPORT 0

#if defined(FOTA_DISABLE_DELTA)
#define __FOTA_MANIFEST_BASE_SIZE 172
#else
#define __FOTA_MANIFEST_BASE_SIZE 247
#endif

#endif  // (FOTA_MANIFEST_SCHEMA_VERSION < 3)

#if !defined(FOTA_MANIFEST_MAX_SIZE)
#define FOTA_MANIFEST_MAX_SIZE (__FOTA_MANIFEST_BASE_SIZE + FOTA_MANIFEST_URI_SIZE + __FOTA_VENDOR_DATA_OVERHEAD + FOTA_MANIFEST_VENDOR_DATA_SIZE)
#endif

#ifndef MBED_CLOUD_CLIENT_FOTA_RESUME_SUPPORT
#define MBED_CLOUD_CLIENT_FOTA_RESUME_SUPPORT FOTA_RESUME_SUPPORT_RESUME
#endif

#if !defined(MBED_CLOUD_CLIENT_FOTA_FW_HEADER_VERSION)
#define MBED_CLOUD_CLIENT_FOTA_FW_HEADER_VERSION 3
#endif

#undef FOTA_INTERNAL_COMPONENTS_SUPPORT
#if (MBED_CLOUD_CLIENT_FOTA_MULTICAST_SUPPORT == FOTA_MULTICAST_BR_MODE)
#if (MBED_CLOUD_CLIENT_FOTA_ENCRYPTION_SUPPORT == 1) || (MBED_CLOUD_CLIENT_FOTA_RESUME_SUPPORT == FOTA_RESUME_SUPPORT_RESUME)
#error Multicast border router mode does not support encryption or full resume
#endif
#define FOTA_INTERNAL_COMPONENTS_SUPPORT 1
#endif

#if (MBED_CLOUD_CLIENT_FOTA_MULTICAST_SUPPORT == FOTA_MULTICAST_NODE_MODE)
#if (MBED_CLOUD_CLIENT_FOTA_ENCRYPTION_SUPPORT == 1) || (MBED_CLOUD_CLIENT_FOTA_RESUME_SUPPORT == FOTA_RESUME_SUPPORT_RESUME)
#error Multicast node mode does not support encryption or full resume
#endif
#endif

#undef FOTA_COMPONENT_SUPPORT
#if (FOTA_NUM_COMPONENTS > 1) || defined(FOTA_INTERNAL_COMPONENTS_SUPPORT) || defined(TARGET_LIKE_LINUX)
#define FOTA_COMPONENT_SUPPORT 1
#endif

#if (MBED_CLOUD_CLIENT_FOTA_FW_HEADER_VERSION >= 3)

#define FOTA_HEADER_HAS_CANDIDATE_READY 1

#else  // LEGACY profile (MBED_CLOUD_CLIENT_FOTA_FW_HEADER_VERSION == 2)

#if (FOTA_NUM_COMPONENTS > 1) || defined(FOTA_INTERNAL_COMPONENTS_SUPPORT)
// Special case: support component update on legacy devices.
// Here main component won't have the candidate ready header, but all other components will.
#define FOTA_HEADER_HAS_CANDIDATE_READY 1
#else
// Regular legacy case
#define FOTA_HEADER_HAS_CANDIDATE_READY 0
#endif

#if (MBED_CLOUD_CLIENT_FOTA_ENCRYPTION_SUPPORT == 1)
#error MBED_CLOUD_CLIENT_FOTA_ENCRYPTION_SUPPORT enabled only for header version >= 3
#endif // !defined(MBED_CLOUD_CLIENT_FOTA_ENCRYPTION_SUPPORT)

#if (MBED_CLOUD_CLIENT_FOTA_RESUME_SUPPORT == FOTA_RESUME_SUPPORT_RESUME)
// force resume restart for legacy profile
#undef MBED_CLOUD_CLIENT_FOTA_RESUME_SUPPORT
#define MBED_CLOUD_CLIENT_FOTA_RESUME_SUPPORT FOTA_RESUME_SUPPORT_RESTART
#endif

#endif // (MBED_CLOUD_CLIENT_FOTA_FW_HEADER_VERSION >= 3)

#if !defined(MBED_CLOUD_CLIENT_FOTA_DOWNLOAD)
#if defined(TARGET_LIKE_LINUX)
#define MBED_CLOUD_CLIENT_FOTA_DOWNLOAD MBED_CLOUD_CLIENT_FOTA_CURL_HTTP_DOWNLOAD
#else
#define MBED_CLOUD_CLIENT_FOTA_DOWNLOAD MBED_CLOUD_CLIENT_FOTA_COAP_DOWNLOAD
#endif // defined(TARGET_LIKE_LINUX)
#endif // !defined(MBED_CLOUD_CLIENT_FOTA_DOWNLOAD)

#if (MBED_CLOUD_CLIENT_FOTA_DOWNLOAD == MBED_CLOUD_CLIENT_FOTA_CURL_HTTP_DOWNLOAD)
#if !defined(TARGET_LIKE_LINUX)
#error curl http download available only for linux
#endif

#if !defined(MBED_CLOUD_CLIENT_FOTA_CURL_PAYLOAD_SIZE)
#define MBED_CLOUD_CLIENT_FOTA_CURL_PAYLOAD_SIZE 0x4000L
#endif

#endif  // (MBED_CLOUD_CLIENT_FOTA_DOWNLOAD == MBED_CLOUD_CLIENT_FOTA_CURL_HTTP_DOWNLOAD)

#if (FOTA_SOURCE_LEGACY_OBJECTS_REPORT == 1)
#define FOTA_MCCP_PROTOCOL_VERSION 3
#else
#define FOTA_MCCP_PROTOCOL_VERSION 4
#endif

#endif  // MBED_CLOUD_CLIENT_FOTA_ENABLE

#endif  // __FOTA_CONFIG_H_
